﻿@{
    ViewBag.Title = "流程管理";
    Layout = "~/Views/Shared/_FrameLayout.cshtml";
}
@section scripts
{


    <script>

        function openDesign(defid, defName) {

            parent.layer.open({
                title: defName + '_流程定义',
                type: 2,
                content: '/FlowDesign/FlowDesign?id=' + defid,
                area: ['1000px', '550px']
                //btn: ['确认', '关闭'],
                //btnclass: ['btn btn-primary', 'btn btn-danger'],
                //yes: function (index, layero) {
                //    var tem = $(layero).find("iframe")[0].contentWindow.getContent();
                //    setPostData(tem.Id, tem.PostName);
                //    parent.layer.close(index);
                //}, cancel: function () {
                //    return true;
                //}
            });
        }


        function openPic(defid,defName) {

            parent.layer.open({
                title: defName + '_流程图',
                type: 2,
                content: '/FlowDesign/Pic?id=' + defid,
                area: ['1000px', '550px']
               
            });
        }

        $(document).ready(function() {
            var config = {
                title: '流程管理',
                url: '@Url.Action("GetList")',
                colNames: ['主键', '流程定义Key', '流程定义名称', '创建时间','所属类别', '状态'],
                colModel: [
                    { name: 'Id', index: 'Id', width: 60, key: true, hidden: true },
                    { name: 'WorkFlowDefKey', index: 'WorkFlowDefKey', width: 30 },
                    { name: 'WorkFlowDefName', index: 'WorkFlowDefName', width: 30 },
                    { name: 'CreateDate', index: 'CreateDate', width: 30, formatter: 'date', formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
                    { name: 'CategoryName', index: 'CategoryName', width: 30 },
                    {
                        name: 'UserStatus',
                        index: 'UserStatus',
                        width: 20,
                        align: 'center',
                        sortable: false,
                        formatter: function(cellValue, options, rowObject) {
                            return '<button class="btn btn-xs" onclick="openDesign(\'' + rowObject.Id + '\',\'' + rowObject.WorkFlowDefName + '\');">流程设计</button>&nbsp;<button class="btn btn-xs" onclick="openPic(\'' + rowObject.Id + '\',\'' + rowObject.FlowDefName + '\');">流程图</button>';

                        }
                    }
                ],
                sortname: 'CreateDate',
                sortorder: "desc"
            };
            WikeGrid.Load(config);
        });
    </script>
}
 

<form id="searchToolBar" class="alert alert-info form-inline toolbarsearch" action="">
    <div class="form-group">
        <input type="text" id="keywords" name="keywords" autocomplete="off" class="form-control" placeholder="请输入关键字" />
    </div>
    <button class="btn btn-danger" id="btnSearch" type="button">
        <i class="fa menu-icon fa-cog "></i>查询
    </button>
    <button class="btn btn-default" data-url="@Url.Action("Add")" id="btnAdd" type="button">
        添加
    </button>
    <button class="btn btn-default" data-url="@Url.Action("Edit")" id="btnEdit" type="button">
        编辑
    </button>
    <button class="btn btn-default" data-url="@Url.Action("Delete")" id="btnDelete" type="button">
        删除
    </button>
</form>
<div class="jqGrid_wrapper">
    <table id="table_list"></table>
    <div id="pager_list"></div>
</div>